#version 330 core

out vec4 FragColor;

uniform vec2 iResolution;
uniform float iTime;

float sdCircle( vec2 position, float radius)
{
    return length(position) - radius;
}

void mainImage(out vec4 fragColor, vec2 fragCoord)
{
    vec2 uv = fragCoord/iResolution.xy;

//    vec2 position = fragCoord / iResolution.xy; //四分之一圆
    vec2 position = (2.0* fragCoord - iResolution.xy) / iResolution.xy; // 中心圆 图1
    float distance = sdCircle(position, 0.5);

    vec3 color = ( distance > 0.0) ? vec3(0.9, 0.6, 0.3) : vec3(0.65, 0.85, 1.0);
//    color *= 1.0 - exp(-6.0 * abs(distance));
//    color *= exp(abs(distance));//计算e^x 的值，e= 2.71828182845904523536，叠加，变亮图2
//    color *= exp(-6.0 * abs(distance));//计算倒数，叠加，变暗  图3
//    color = vec3(exp(-6.0 * abs(distance)));// 白圆
//    color = vec3(1.0 - exp(-6.0 * abs(distance)));// 黑圆
     color *= 1.0 - exp(-6.0 * abs(distance));//叠加，黑圆  图4
     color *= 0.8 + 0.2 * cos(150.0 * distance);//同心圆
//     color = vec3(1.0 - smoothstep(0.0, 0.01, abs(distance))); //  白圈
     color = mix(color, vec3(1.0), 1.0 - smoothstep(0.0, 0.01, abs(distance))); // 混合颜色

    // Output to screen
    fragColor = vec4(color, 1.0);
}

void main()
{
    vec4 fragColor;
    mainImage(fragColor, gl_FragCoord.xy);

    FragColor = fragColor;
}
